﻿using UnityEngine;
using System.Collections;

public class SelectLevel : MonoBehaviour 
{
	public GUIStyle myStyle;
	public GUIStyle buttonStyle;
	public Texture tex;
	public Texture background;
	public Texture bloqueado;
	public Texture fundobloqueado;
	
	public int posx1 = 260;
	public int posx2 = 390;
	public int posx3 = 520;
	public int posx4 = 650;
	
	public int posy1 = 240;
	public int posy2 = 430;
	
	public static bool Level01Unblock = true;
	public static bool Level02Unblock = false;
	public static bool Level03Unblock = false;
	public static bool Level04Unblock = false;
	public static bool Level05Unblock = false;
	public static bool Level06Unblock = false;
	public static bool Level07Unblock = false;
	public static bool Level08Unblock = false;
	public bool desativado = false;
	
	void OnGUI () 
	{	
		GUI.DrawTexture(new Rect(0,0,Screen.width,Screen.height), background);
		GUI.DrawTexture(new Rect((Screen.width/2)-(400/2),30,400,100), tex);
		GUI.Label(new Rect((Screen.width/2)-(400/2)+100, -20, 200, 200), "Select Level", myStyle);
		
		//back
		if(GUI.Button(new Rect((Screen.width/100)*(10)-(130/2), ((Screen.height/100)*(90)-(70/2)), 130, 70), "Back", buttonStyle))
		{
			Application.LoadLevel("Menu");
		}	
		
		
		//level01
		if(Level01Unblock)
		{	
			if(GUI.Button(new Rect((Screen.width/100)*(20)-(100/2), ((Screen.height/100)*(40)-(100/2)), 100, 100), "Level 1", buttonStyle))
			{
				Application.LoadLevel("stage01");
			}
		}
		else
		{
			GUI.DrawTexture(new Rect((Screen.width/100)*(20)-(100/2), ((Screen.height/100)*(40)-(100/2)),100,100), fundobloqueado);
			GUI.DrawTexture(new Rect((Screen.width/100)*(20)-(100/2), ((Screen.height/100)*(40)-(100/2)),100,100), bloqueado);
		}
		
		//level02
		if(Level02Unblock)
		{	
			if(GUI.Button(new Rect((Screen.width/100)*(40)-(100/2), ((Screen.height/100)*(40)-(100/2)), 100, 100), "Level 2", buttonStyle))
			{
				Application.LoadLevel("Level 2");
			}
		}
		else
		{
			GUI.DrawTexture(new Rect((Screen.width/100)*(40)-(100/2), ((Screen.height/100)*(40)-(100/2)),100,100), fundobloqueado);
			GUI.DrawTexture(new Rect((Screen.width/100)*(40)-(100/2), ((Screen.height/100)*(40)-(100/2)),100, 100), bloqueado);
		}
		
		//level03
		if(Level03Unblock)
		{	
			if(GUI.Button(new Rect((Screen.width/100)*(60)-(100/2), ((Screen.height/100)*(40)-(100/2)), 100, 100), "Level 3", buttonStyle))
			{
				Application.LoadLevel("Level 3");
			}
		}
		else
		{
			GUI.DrawTexture(new Rect((Screen.width/100)*(60)-(100/2), ((Screen.height/100)*(40)-(100/2)),100,100), fundobloqueado);
			GUI.DrawTexture(new Rect((Screen.width/100)*(60)-(100/2), ((Screen.height/100)*(40)-(100/2)),100,100), bloqueado);
		}
		
		//level04
		if(Level04Unblock)
		{	
			if(GUI.Button(new Rect((Screen.width/100)*(80)-(100/2), ((Screen.height/100)*(40)-(100/2)), 100, 100), "Level 4", buttonStyle))
			{
				Application.LoadLevel("Level 4");
			}
		}
		else
		{
			GUI.DrawTexture(new Rect((Screen.width/100)*(80)-(100/2), ((Screen.height/100)*(40)-(100/2)),100,100), fundobloqueado);
			GUI.DrawTexture(new Rect((Screen.width/100)*(80)-(100/2), ((Screen.height/100)*(40)-(100/2)),100,100), bloqueado);
		}
		
		/*	
			//level05
			if(Level05Unblock)
			{	
				if(GUI.Button(new Rect((Screen.width/100)*(20)-(100/2), ((Screen.height/100)*(70)-(100/2)), 100, 100), "Level 5", buttonStyle))
				{
					//Application.LoadLevel("Level 5");
				}
			}
			else
			{
			GUI.DrawTexture(new Rect((Screen.width/100)*(20)-(100/2), ((Screen.height/100)*(70)-(100/2)),100,100), fundobloqueado);
			GUI.DrawTexture(new Rect((Screen.width/100)*(20)-(100/2), ((Screen.height/100)*(70)-(100/2)),100,100), bloqueado);
			}
		
		//level06
		if(Level06Unblock)
		{	
			if(GUI.Button(new Rect((Screen.width/100)*(40)-(100/2), ((Screen.height/100)*(70)-(100/2)), 100, 100), "Level 6", buttonStyle))
			{
				//Application.LoadLevel("Level 6");
			}
		}
		else
		{
			GUI.DrawTexture(new Rect((Screen.width/100)*(40)-(100/2), ((Screen.height/100)*(70)-(100/2)),100,100), fundobloqueado);
			GUI.DrawTexture(new Rect((Screen.width/100)*(40)-(100/2), ((Screen.height/100)*(70)-(100/2)),100,100), bloqueado);
		}
		
		//level07
		if(Level07Unblock)
		{	
			if(GUI.Button(new Rect((Screen.width/100)*(60)-(100/2), ((Screen.height/100)*(70)-(100/2)), 100, 100), "Level 7", buttonStyle))
			{
				//Application.LoadLevel("Level 7");
			}
		}
		else
		{
			GUI.DrawTexture(new Rect((Screen.width/100)*(60)-(100/2), ((Screen.height/100)*(70)-(100/2)),100,100), fundobloqueado);
			GUI.DrawTexture(new Rect((Screen.width/100)*(60)-(100/2), ((Screen.height/100)*(70)-(100/2)),100,100), bloqueado);
		}
		
		//level08
		if(Level08Unblock)
		{	
			if(GUI.Button(new Rect((Screen.width/100)*(80)-(100/2), ((Screen.height/100)*(70)-(100/2)), 100, 100), "Level 8", buttonStyle))
			{
				//Application.LoadLevel("Level 8");
			}
		}
		else
		{
			GUI.DrawTexture(new Rect((Screen.width/100)*(80)-(100/2), ((Screen.height/100)*(70)-(100/2)),100,100), fundobloqueado);
			GUI.DrawTexture(new Rect((Screen.width/100)*(80)-(100/2), ((Screen.height/100)*(70)-(100/2)),100,100), bloqueado);
		}
		*/
	}

}
